#ifndef LIST_H
#define LIST_H

#include <pthread.h>
#include "utils.h"

typedef struct node {
    void *block;
    struct node *next;
    struct node *pre;
} node;
typedef struct list {
    pthread_mutex_t mutex;
    int size;
    int count;
    node *head;
} list;

typedef int (*comp_func)(const void *, const void *);
typedef int (*search_func)(const void *, const void *);

void list_create(list *l, int blocksize);
void list_append(list *l, void *data);
int list_remove(list *l, void *data);
void* list_search(list *l, void *, search_func search);
void list_sort(list *l, comp_func comp);
void list_cleanup(list *l);

#endif /* LIST_H */

    
